<?php
class LogListener extends Doctrine_Record_Listener
{
	private $_modified = null;
	private function saveLog(Doctrine_Event $event)
	{
//		$log = new LogSistema();
//		$log->set('id_usuario', sfContext::getInstance()->getUser()->isAnonymous() ? null : sfContext::getInstance()->getUser()->getGuardUser()->getId());
//		$log->set('ds_sql', $this->_modified);
//		$log->set('ds_action', $event->getName().' - '.sfContext::getInstance()->getModuleName().'/'.sfContext::getInstance()->getActionName());
//		$log->set('id_chave', $event->getInvoker()->getIterator()->current());
//		$log->save();
	}

	public function postSave(Doctrine_Event $event)
	{
		$this->saveLog($event);
	}

	public function preSave(Doctrine_Event $event)
	{
		foreach ($event->getInvoker()->getModified() as $key => $value)
		{
			$this->_modified.= "$key = $value | ";
		}
	}
}